package analysis;

import java.io.PrintStream;


public aspect Helper_aj {


	private boolean printInConsole = true; 
	
	pointcut output(String s, PrintStream p) : call ( * java.io.PrintStream.print*(String) ) && args(s) && target(p);

	
	void around(PrintStream p, String s): output(s,p){
		if(printInConsole){
			proceed(p,s);
		}
	}

	/*
	before(PrintStream p, String s) :output(s, p){
		try {
			if(p.equals(System.out)){
				BufferedReader r = new BufferedReader(new FileReader(new File("log.OK")));
				String s1="" ;
				String aux = r.readLine();
				while(aux!=null){
					s1+=aux+"\n";
					aux=r.readLine();
				}
				r.close();
				buff = new BufferedWriter(new FileWriter(new File("log.OK")));
				buff.append(s1+s+"\n");
				buff.close();
			} else {
				BufferedReader r = new BufferedReader(new FileReader(new File("log.error")));
				String s1="" ;
				String aux = r.readLine();
				while(aux!=null){
					s1+=aux+"\n";
					aux=r.readLine();
				}
				errorr = new BufferedWriter(new FileWriter(new File("log.error")));
				errorr.append(s1+s+"\n");
				errorr.close();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
*/
}
